//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.dstz.bpm.engine.parser.flow;

import com.dstz.bpm.api.model.def.BpmDataModel;
import com.dstz.bpm.engine.model.DefaultBpmProcessDef;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.springframework.stereotype.Component;

@Component
public class FlowDataModelParse extends AbsFlowParse<BpmDataModel> {
   public FlowDataModelParse() {
   }

   public String getKey() {
      return "dataModelList";
   }

   public String validate(Object object) {
      List<BpmDataModel> list = (List)object;
      Set<String> keys = new HashSet();
      Iterator var4 = list.iterator();

      while(var4.hasNext()) {
         BpmDataModel def = (BpmDataModel)var4.next();
         String key = def.getCode();
         if (keys.contains(key)) {
            throw new RuntimeException("解析流程数据模型出错code：" + key + "在流程中重复配置！");
         }

         keys.add(def.getCode());
      }

      return "";
   }


   @Override
   public void setDefParam(DefaultBpmProcessDef bpmProcessDef, Object object) {
      List<BpmDataModel> list = (List)object;
      bpmProcessDef.setDataModelList(list);
   }

   public boolean isArray() {
      return true;
   }
}
